from django.contrib import admin
from .models import Drivinginfo, DrivingMode, LogisticsMode, BasicInfo


@admin.register(Drivinginfo)
class DrivinginfoAdmin(admin.ModelAdmin):
    list_display = ('car_number', 'vin', 'data_time', 'longitude', 'latitude', 'car_speed',
                    'atmospheric_pressure', 'actual_torque', 'friction_torque',
                    'engine_speed', 'fuel_flow', 'scr_up_nox', 'scr_down_nox',
                    'reactive_agent', 'air_intake', 'scr_inlet_temperature',
                    'scr_outlet_temperature', 'dpf_pressure_difference',
                    'coolant_temperature', 'tank_level', 'accumulation_mile',
                    'location_status', 'engine_status', 'fuel_consumption',
                    'fuel_consumption_pre')
    search_fields = ('car_number', 'vin')
    list_filter = ('car_number', 'vin')
    list_per_page = 100


@admin.register(BasicInfo)
class BasicInfoAdmin(admin.ModelAdmin):
    list_display = ('vin', 'car_number')
    search_fields = ('vin', 'car_number')


@admin.register(DrivingMode)
class DrivingModeAdmin(admin.ModelAdmin):
    list_display = ('basic_info', 'driving_mode', 'car_speed_mean', 'car_speed_sd',
                    'acceleration_sd', 'overspeed_proportion', 'rapid_acceleration_proportion',
                    'engine_speed_mean', 'engine_speed_sd')
    search_fields = ('basic_info__vin', 'driving_mode')
    list_filter = ('basic_info__vin', 'driving_mode')
    list_per_page = 100


@admin.register(LogisticsMode)
class LogisticsModeAdmin(admin.ModelAdmin):
    list_display = ('basic_info', 'logistics_mode', 'radius_of_gyration', 'daily_travel_location',
                    'motion_entropy', 'daily_driving_distance', 'daily_driving_time')
    search_fields = ('basic_info__vin', 'logistics_mode')
    list_filter = ('basic_info__vin', 'logistics_mode')
    list_per_page = 100
